<script setup>
defineProps({
  title: {
    type: String,
    required: true
  }
})
</script>

<template>
  <el-card class="page_container">
    <template #header>
      <div class="header">
        <span class="title">{{ title }}</span>
        <div class="extra">
          <slot name="extra"></slot>
        </div>
      </div>
    </template>
    <slot></slot>
  </el-card>
</template>

<style scoped>
.page_container {
  min-height: 100%;
  box-sizing: border-box;

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%; /* 确保宽度填满 */
    gap: 16px; /* 可选：添加间距 */
    font-size: 18px;
    font-weight: bold;
    color: #333;

    .title {
      white-space: nowrap; /* 防止标题换行 */
    }

    .extra {
      display: flex;
      align-items: center;
      flex-shrink: 0; /* 防止被压缩 */
    }
  }
}

.page_container:hover {
  box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.12) !important;
}
</style>
